<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <div class="section">
                <h1>Cadastrando Corretor</h1>
                <h:form id="formCorrector">
                    <p:growl id="msg" life="3000"/>
                    <div class="container_24 clearfix">
                        <p:panel header="Dados Gerais" >
                            <p:outputLabel value="Nome:" styleClass="grid_3" for="nameInputText" />
                            <p:inputText id="nameInputText" required="true" 
                                        styleClass="grid_20 ajustInput" value="#{managerCreateCorrector.corrector.name}"  />

                            <p:outputLabel value="Creci:" styleClass="grid_3" for="creciInputText" />
                            <p:inputText id="creciInputText" maxlength="6" 
                                        styleClass="grid_8" required="true"
                                        value="#{managerCreateCorrector.corrector.creci}" />

                            <p:outputLabel value="CPF:" styleClass="grid_3" for="cpfInputMask" />
                            <p:inputMask id="cpfInputMask" mask="999.999.999-99" 
                                        styleClass="grid_8" required="true"
                                        value="#{managerCreateCorrector.corrector.cpf}" />

                            <div class="clear"/>
                        </p:panel>
                        
                        <p:panel header="Dados Bancários">
                            <p:outputLabel value="Banco:" styleClass="grid_3" />
                            <p:inputText styleClass="grid_8" value="#{managerCreateCorrector.corrector.nameBank}" />

                            <p:outputLabel value="Conta:" styleClass="grid_3" />
                            <p:inputText styleClass="grid_8" value="#{managerCreateCorrector.corrector.account}" />

                            <p:outputLabel value="Agência:" styleClass="grid_3" />
                            <p:inputText styleClass="grid_8" value="#{managerCreateCorrector.corrector.agency}"  />

                            <p:outputLabel value="Operação:" styleClass="grid_3" />
                            <p:inputText styleClass="grid_8" value="#{managerCreateCorrector.corrector.operation}"  />

                            <div class="clear"/>
                        </p:panel>
                        
                        <p:panel header="Endereço">
                            <p:outputLabel value="Rua:" styleClass="grid_3" />
                            <p:inputText styleClass="grid_20 ajustInput" value="#{managerCreateCorrector.corrector.address.patio}" />

                            <p:outputLabel value="Cep:" styleClass="grid_3" />
                            <p:inputMask mask="99.999-999" styleClass="grid_8" value="#{managerCreateCorrector.corrector.address.cep}" />

                            <p:outputLabel value="Bairro:" styleClass="grid_3" />
                            <p:inputText  styleClass="grid_8" value="#{managerCreateCorrector.corrector.address.district}" />
                            <p:outputLabel value="Complemento:" styleClass="grid_3 complementLabel" />
                            <p:inputText styleClass="grid_8"  value="#{managerCreateCorrector.corrector.address.complement}" />

                            <p:outputLabel value="Nº:" styleClass="grid_3" />
                            <p:inputText styleClass="grid_8" value="#{managerCreateCorrector.corrector.address.num}" />
                            <p:outputLabel  value=" Cidade: " styleClass="grid_3"  />
                            <p:autoComplete styleClass="grid_8" dropdown="true" converter="cityconverter"   
                                            var="cityValue" itemLabel="#{cityValue.name.toString().concat(' - ')}#{cityValue.country.sgl}" 
                                            itemValue="#{cityValue}" value="#{managerCreateCorrector.corrector.address.city}"
                                            scrollHeight="200" forceSelection="true"
                                            completeMethod="#{managerCity.autocomplete}" /> 


                            <p:outputLabel value="Tipo:"  styleClass="grid_3 correctorAddressTypeLabel"/>
                            <div class="grid_8">
                                <p:selectOneMenu panelStyle="width:150px;" value="#{managerCreateCorrector.corrector.address.typeAddress}">  
                                    <f:selectItem itemLabel="" itemValue="" />  
                                    <f:selectItems value="#{managerCreateCustomer.typeAddress}" />  
                                </p:selectOneMenu> 
                            </div>

                            <div class="clear"/>
                        </p:panel>
                        
                        <p:panel header="Usuário">
                            <p:outputLabel  value="Login:" styleClass="grid_3" for="loginName"  />
                            <p:inputText styleClass="grid_6" id="loginName" required="true" requiredMessage="Nome de Usuário é obrigatório." value="#{managerCreateCorrector.user.login}" />

                            <div class="clear-both" />  
                            <p:outputLabel  value="Senha: " styleClass="grid_3" for="password" />
                            <p:password styleClass="grid_6" feedback="true" value="#{managerCreateCorrector.user.password}"
                                        goodLabel="Bom" promptLabel="Insira sua senha" strongLabel="Forte" weakLabel="Fraco"
                                        id="password" required="true" requiredMessage="Senha do Usuário é obrigatório."/>
                            <div class="clear-both"/>
                            <p:outputLabel  value="Repita a senha: " styleClass="grid_3 repeatPasswordLabel"  />
                            <p:password styleClass="grid_6" value="#{managerCreateCorrector.confirm}" />
                            <div class="clear"/>
                        </p:panel>
                        <div class="buttonAction">
                            <p:commandButton value="Salvar" 
                                             actionListener="#{managerCreateCorrector.save()}"
                                             update="@form" 
                                             icon="ui-icon-disk" 
                                             styleClass="ui-priority-primary"/>
                            <p:commandButton value="Limpar" icon="ui-icon-close"/>
                            <p:button value="Voltar"
                                      href="indexcorrector.xhtml"
                                      icon="ui-icon-arrowreturnthick-1-w"/>

                        </div>
                </div>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>

</html>
